var typeName
$(function(){
	typeName = 'TXN';
	list();

})

//下拉切换事件

function change(){
	typeName = $('#econpous option:selected').val();
	list();
}

function list(){
	var htmlList = '';
	var arr = {
		hf_s_id: 'WD11',
		hf_srv_id: 'Av_jcoupon_wallet',
		hs_check_cart_value: 'N',
	}
	getAjaxRequest(arr,function(result){
		var item = result.bvc_coupon_item;
		var len = item.length;
		if( len > 0 ){
			for ( var i = 0; i<len; i++) {
				console.log(typeName+":"+item[i].bs_coupon_type)
				if( item[i].bs_coupon_type == typeName ){
					htmlList += '<div class="item">'+
							'<h4>'+item[i].bs_prom_text+'</h4>'+
							'<span>Terms & Conditions</span>'+
							'<p> Expiry Date: '+item[i].bs_end_dt+'</p>'+
							'<a class="mui-btn active">Redeem Now</a>'+
							'</div>';
				}

			}
			$('.list').html(htmlList);
		}else {
			$('.list').html('');
		}
	})
}
